//
//  ParticleSystem.h
//  DeferredLighting
//
//  Created by Holmes Futrell on 2/14/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <OpenCL/OpenCL.h>
#import <OpenGL/gl.h>

#import "ComputeProgram.h"
#import "SimpleCompute.h"
#import "ShaderProgram.h"
#import "matrix.h"
#import "GLTexture.h"

@interface ParticleSystem : NSObject {
	
	GLuint glPositionsBuffer, glVelocitiesBuffer, glAgeBuffer;
	cl_mem clPositionsBuffer, clVelocitiesBuffer, clAgeBuffer;
	cl_mem eyespaceParticles;
	
	GLTexture *billboard;
	
	int numParticles;

	ComputeProgram *particleProgram;
	SimpleCompute *simpleCompute;
	
	ShaderProgram *particleShader;
	
	float animationTime;
	
}

-(id)initWithNumParticles:(int)_numParticles simpleCompute:(SimpleCompute *)simpleCompute;

-(void)stepParticleSystem:(float)timeDiff reset:(BOOL)reset modelviewMatrix:(mat4)modelview;
-(void)drawParticlesWithModelviewMatrix:(mat4)modelview projectionMatrix:(mat4)projection;

@property (readonly) cl_mem eyespaceParticles;
@property (readonly) int numParticles;

@end
